package com.exam.admin.mapper;

import com.exam.entity.Admin;
import com.exam.entity.dto.LogTableDto;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AdminMapper {
    Page<LogTableDto> findAllLog();

    LogTableDto findByIdLog(Integer logId);

    @Delete("delete from stulog_table where id = #{id}")
    int deleteMyLog(int id);

    int insertMyLog(LogTableDto logTableDto);

    @Select("select * from admin where adminId = #{adminId}")
    Admin adminById(Long adminId);

    List<LogTableDto> getMyLogData(String begin, String end);

    int insertAdmin(Admin admin);

    @Delete("delete from admin where faceId = #{fid}")
    void deleteByFaceIdAdmin(Integer fid);

    @Update("UPDATE admin SET adminName = #{faceName} WHERE faceId = #{fid}")
    void updateAdmin(String faceName, Integer fid);

    @Select("select * from admin where faceId = #{fid}")
    Admin findByIdAdmin(Integer fid);

    @Delete("delete from admin where adminId = #{adminId}")
    int deleteByIdAdmin(Long adminId);



}
